package com.bluesky.javawebbrowser.domain.html.tags.table;

import com.bluesky.javawebbrowser.domain.html.tags.Tag;
import com.bluesky.javawebbrowser.domain.html.tags.TagType;

public class TR extends Tag {
	public TR() {
		super(TagType.TR);
	}

	public TR(Tag tag) {

		super(tag);
		tagType = TagType.TR;
	}

	protected void addTD(TD td) {
		addChild(td);
	}

	public void addColums(Tag[] tags) {
		for (Tag t : tags) {
			TD td = new TD();
			td.addChild(t);

			addTD(td);
		}
	}

	/**
	 * clone TD
	 * 
	 * @param length
	 */
	public void expandColumns(int length) {
		for (int i = 0; i < length; i++) {
			TD td = (TD) getChildren().get(0);
			TD newTD = (TD) td.clone();
			addChild(newTD);
		}
	}
}
